/*
 *Author: 蔡亚风
 *Date: 2022-03-11 17:15:27
 *LastEditTime: 2022-06-29 15:50:07
 *LastEditors: 蔡亚风
 *Description:
 *FilePath: \prod\src\components\BigInput\register.js
 */
import { createVNode, render } from 'vue'
import BigInput from './index.vue' //引入组件

//初始化dom容器
const div = document.createElement('div')
div.setAttribute('class', 'my-BigInput_' + Date.now())
document.body.appendChild(div)

export default (props) => {
  //新建promise
  return new Promise((resolve) => {
    // 确认的回调
    const submitCallback = (val) => {
      render(null, div)
      //确认后返回传参
      resolve(val)
    }
    const vnode = createVNode(BigInput, {
      ...props,
      submitCallback,
    })
    //渲染
    render(vnode, div)
  })
}
